var fn;
function foo(){
    var a=2;
    function baz(){
        console.log(a);
    }
    fn=baz;
    console.log(fn);
}
function bar(){
    fn();
}
foo();
bar();
function wait(message) { 
    setTimeout( function timer() { 
    console.log( message ); 
    }, 1000 ); 
   } 
   wait( "Hello, closure!" );
   for (var i=1; i<=5; i++) { 
    (function(){
        var j=i;
        setTimeout( function timer() { 
    console.log(j)
    }, j*1000 ); 
})()
}
   //所有的回调函数依然是在循环结束后才会被执行
   //console.log(j);

   